#pragma once

#include "HashTable.h"

namespace Lzc
{
	template<class K, class Hash = HashFunc<K>>
	class UnorderedSet
	{
		struct SetKfromT
		{
			const K& operator()(const K& key)
			{
				return key;
			}
		};
	public:
		typedef typename HashTable<K, const K, SetKfromT, Hash>::Iterator iterator;
		typedef typename HashTable<K, const K, SetKfromT, Hash>::ConstIterator const_iterator;
		pair<iterator, bool> insert(const K& kv)
		{
			return _ht.Insert(kv);
		}

		bool erase(const K& key)
		{
			return _ht.Erase(key);
		}

		iterator find(const K& key)
		{
			return _ht.Find(key);
		}

		const_iterator find(const K& key) const
		{
			return _ht.Find(key);
		}
		iterator begin()
		{
			return _ht.Begin();
		}

		iterator end()
		{
			return _ht.End();
		}

		const_iterator begin() const
		{
			return _ht.Begin();
		}

		const_iterator end() const
		{
			return _ht.End();
		}
	private:
		HashTable<K, const K, SetKfromT, Hash> _ht;
	};
}